<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.container {
  display: inline-block;
}
.parent {
  stroke: blue;
}
.target {
  fill: black;
  stroke-width: 8px;
  stroke: orange;
  color: blue;
}
.expected {
  fill: lime;
}
</style>
<body>
<template id="target-template">
  <svg width="10" height="100">
    <defs>
      <linearGradient id="gradient" x1="0" x2="0" y1="0" y2="1">
        <stop offset="0" stop-color="black"/>
        <stop offset="1" stop-color="blue"/>
      </linearGradient>
    </defs>
    <rect x="0" y="0" width="10" height="100"></rect>
  </svg>
</template>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
  property: 'stroke',
  from: neutralKeyframe,
  to: 'green',
}, [
  {at: -0.4, is: 'rgb(255, 180, 0)'},
  {at: 0, is: 'rgb(255, 165, 0)'},
  {at: 0.2, is: 'rgb(204, 158, 0)'},
  {at: 0.6, is: 'rgb(102, 143, 0)'},
  {at: 1, is: 'rgb(0, 128, 0)'},
  {at: 1.5, is: 'rgb(0, 110, 0)'},
]);

assertNoInterpolation({
  property: 'stroke',
  from: 'initial',
  to: 'green',
});

assertInterpolation({
  property: 'stroke',
  from: 'inherit',
  to: 'green',
}, [
  {at: -0.4, is: 'rgb(0, 0, 255)'},
  {at: 0, is: 'rgb(0, 0, 255)'},
  {at: 0.2, is: 'rgb(0, 26, 204)'},
  {at: 0.6, is: 'rgb(0, 77, 102)'},
  {at: 1, is: 'rgb(0, 128, 0)'},
  {at: 1.5, is: 'rgb(0, 192, 0)'},
]);

assertInterpolation({
  property: 'stroke',
  from: 'unset',
  to: 'green',
}, [
  {at: -0.4, is: 'rgb(0, 0, 255)'},
  {at: 0, is: 'rgb(0, 0, 255)'},
  {at: 0.2, is: 'rgb(0, 26, 204)'},
  {at: 0.6, is: 'rgb(0, 77, 102)'},
  {at: 1, is: 'rgb(0, 128, 0)'},
  {at: 1.5, is: 'rgb(0, 192, 0)'},
]);

assertInterpolation({
  property: 'stroke',
  from: 'orange',
  to: 'blue'
}, [
  {at: -0.4, is: '#ffe700'},
  {at: 0, is: 'orange'},
  {at: 0.2, is: '#cc8433'},
  {at: 0.6, is: '#664299'},
  {at: 1, is: 'blue'},
  {at: 1.5, is: 'blue'}
]);
assertInterpolation({
  property: 'stroke',
  from: 'orange',
  to: 'currentColor'
}, [
  {at: 0, is: 'orange'},
  {at: 0.2, is: '#cc8433'},
  {at: 0.6, is: '#664299'},
  {at: 1, is: 'blue'},
]);
assertInterpolation({
  property: 'stroke',
  from: 'currentColor',
  to: 'orange'
}, [
  {at: 0, is: 'blue'},
  {at: 0.2, is: '#3321cc'},
  {at: 0.6, is: '#996366'},
  {at: 1, is: 'orange'},
]);
assertNoInterpolation({
  property: 'stroke',
  from: 'orange',
  to: 'url(#gradient)'
});
</script>
</body>
